/*
* 四川生学教育科技有限公司
* Copyright (c) 2015-2025 Founder Ltd. All Rights Reserved.
*
* This software is the confidential and proprietary information of
* Founder. You shall not disclose such Confidential Information
* and shall use it only in accordance with the terms of the agreements
* you entered into with Founder.
*
*/
package cn.demo.disruptor;

import com.lmax.disruptor.EventHandler;

import java.util.Date;

/**
 * @author WUANG (wa@sxw.cn)
 * @description 消息者事件处理器，打印输出到控制台
 * @date 2018/10/16 17:28
 * @slogon 站在巨人的肩膀上
 * @since 2.0.0
 */
public class LongEventHandler implements EventHandler<LongEvent> {
    public void onEvent(LongEvent event, long sequence, boolean endOfBatch) {
        try {
            //模拟消费者比较慢
//            Thread.sleep(10000000);
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println(new Date() +" consumer:" + Thread.currentThread().getName() + " Event: value=" + event.get() + ",sequence=" + sequence + ",endOfBatch=" + endOfBatch);
    }
}